using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Summary description for PageMapAbstract
/// </summary>
public abstract class PageMapAbstract : PageController
{
    protected StringBuilder sb = null;

    protected string getPuntoCentral(List<BEGMaps> loList)
    {
        string stDev = "new GPoint(0,0)";

        if (loList != null && loList.Count > 0)
        {
            stDev = String.Format("new GPoint({0}, {1})", loList[0].Longitud, loList[0].Latitud);
        }
        return stDev;
    }

    protected string buildTracking(List<BEGMaps> loList)
    {
        string stDev = "new GPoint(0,0)";

        if (loList != null && loList.Count > 0)
        {
            sb = new StringBuilder();
            int i = 0;

            for (i = 0; i < loList.Count; i++)
            {
                if (validaCoordenada(loList[i].Longitud, loList[i].Latitud))
                {
                    sb.Append(String.Format("new GPoint({0}, {1}),", loList[i].Longitud, loList[i].Latitud));
                }
            }

            stDev = sb.ToString();

        }

        return stDev;
    }
   
    protected bool validaCoordenada(String longitud, String latitud)
    {
        try
        {
            if (!longitud.Equals("") && !latitud.Equals("") && double.Parse(longitud) != 0 && double.Parse(latitud) != 0)
            {
                return true;
            }
        }
        catch (Exception e)
        {
        }

        return false;

    }

     
}
